﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Web;

namespace WebApplication7
{
    public class DbHelper
    {
        public static readonly string conntingSTRING = "server=.;database=CMS;uid=sa;pwd=123456";
        public static DataTable GetData(string sql) 
        {
            SqlDataAdapter adapter = new SqlDataAdapter(sql,conntingSTRING);
            DataTable da = new DataTable();
            adapter.Fill(da);
            return da;
        }
        public static int AddOrUpdateOrDe(string sql) 
        {
            SqlConnection sqlConnection = new SqlConnection(conntingSTRING);
            SqlCommand command = new SqlCommand(sql,sqlConnection);
            sqlConnection.Open();
            var res = command.ExecuteNonQuery();
            sqlConnection.Close();
            return res;
        }
    }
}